/*
 *  Copyright 2010 Wesley Gooch, Ryan Nix, Cody Wenzel.
 *  Montana State University - Spring Semester 2010
 *  Computer Science 450 - Compilers
 *  Project: Micro-Pascal Compiler
 */
package msu.compiler.codegenerators;

/**
 *
 * This is a singleton
 *
 * @author wenzel
 */
public class LabelGen {

    private static LabelGen labelGen;
    private int nextLabel = 0;

    public static synchronized LabelGen getLabelGen() {
        if (labelGen == null) {
            labelGen = new LabelGen();
        }
        return labelGen;
    }

    public String getLabel(){
        return "L" + nextLabel++;
    }

}
